package farb.top.eurekaclientriskapp.controller;

import farb.top.eurekaclientriskapp.service.RiskService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RiskController {
    private final RiskService riskService;
    @Value("${server.port}")
    private String port;

    public RiskController(RiskService riskService) {
        this.riskService = riskService;
    }

    @GetMapping("hello")
    public String hello() {
        return "hello,this is Risk Service,and this is node 2";
    }

    @GetMapping("getRiskLevel/{userId}")
    public String getRiskLevel(@PathVariable String userId) {
        System.out.println("当前端口号为：" + this.port);
        return riskService.getRiskLevel(userId);
    }
}
